<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
  <style>
    * {
      margin: 0;
      padding: 0;
    }
    .drop {
      border: 2px dashed #ccc;
      width: 300px;
      height: 150px;
    }
    .img_list {
      display: flex;
    }
    .img_list img {
      width: 100px;
    }
  </style>
</head>
<body>
  <div draggable="true" class="drop"></div>
  <div class="img_list"></div>
  <script>
    const dropEl = document.querySelector('.drop');
    const imgContainer = document.querySelector('.img_list');
    function getImgWH(el) {
      return new Promise(function(reslove, reject) {
        const img = document.createElement('img');
        img.src = el.src;
        img.onload = function() {
          reslove({width: img.width, height: img.height})
        }
        img.onerror = function() {
          reject();
        }

      })
    }
    dropEl.addEventListener('drop', ev => {
      ev.preventDefault();
      ev.cancelBubble = true;
      console.log(ev.dataTransfer.files);
      const fileReader = new FileReader();
      fileReader.readAsDataURL(ev.dataTransfer.files[0]);
      fileReader.onload = ev => {
        console.log(ev);
        const img = document.createElement('img');
        img.src = ev.target.result;
        // console.log(img.width, img.height)
        getImgWH(img)
        .then(res => {
          console.log(res);
        })
        imgContainer.appendChild(img);
      }
    })
    dropEl.addEventListener('dragover', ev => {
      ev.preventDefault();
    });
  </script>
</body>
</html>